package com.ruizhong.PIW.controller;

import com.ruizhong.PIW.entity.TFaceEquipment;
import com.ruizhong.PIW.entity.TShootEquipment;
import com.ruizhong.PIW.service.FaceDeviceService;
import com.ruizhong.PIW.utils.Result;
import com.ruizhong.PIW.utils.ResultCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/faceDevice")
@CrossOrigin
public class FaceDeviceController {
    @Autowired
    private FaceDeviceService faceDeviceService;

    @PostMapping("/update")
    public Result update(@RequestBody TFaceEquipment tFaceEquipment) {
        faceDeviceService.updateById(tFaceEquipment);
        return new Result(ResultCode.success, null, null);
    }

    @GetMapping("/addNewDevice")
    public Result addNewDevice(){
        faceDeviceService.addNewDevice();
        return new Result<>(ResultCode.success,null,null);
    }

    @GetMapping("/getDevicesList")
    public Result getDevicesList(){
        List<TFaceEquipment> list = faceDeviceService.list();
        return new Result(ResultCode.success,null,list);
    }
}
